import numpy as np
import pandas as pd 
sentence = """
He is a good boy who like that girl.
"""

print(sentence.split())

token_sequence = str.split(sentence)
vocab = sorted(set(token_sequence))
print(",".join(vocab))

num_tokens = len(token_sequence)
vocab_size = len(vocab)
onehot_vectors = np.zeros((num_tokens,vocab_size),int)
for i,word in enumerate(token_sequence):
    onehot_vectors[i,vocab.index(word)] = 1
print(onehot_vectors)

onehot_vectors_frame = pd.DataFrame(onehot_vectors,columns=vocab)
print(onehot_vectors_frame)

onehot_vectors_frame[onehot_vectors_frame==0] = ''
print(onehot_vectors_frame)